<?php
/* 获取版本类 */
namespace Api\Controller;
use Think\Controller;

class VersionController extends Controller {

	public function __construct()
	{
		//解决跨域
		echoHeader(); 
	}

	//获取当前版本号
	public function getVersion()
	{
		$type = I('post.type', 'ios', 'trim');
		$type = strtolower($type);
		if (!in_array($type, array('ios','android'))) {
			$type = 'ios';
		}

		if ($type == 'ios') {
			$version = '1.2';
			$link = 'https://appsto.re/cn/K7kDeb.i';
		}else{
			$version = '1.2';
			$link = 'http://www.baidu.com';
		}
		$this->ajaxReturn(array('err_code'=>200,'version'=>$version, 'link'=>$link, 'type'=>$type), 'JSON');
	}
}